package com.example.avmanagerweb.controller;


import com.example.avmanagerweb.entity.SysDepartment;
import com.example.avmanagerweb.result.RLIST;
import com.example.avmanagerweb.service.SysDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xg
 * @since 2023-06-25
 */
@RestController
@RequestMapping("/sys-department")
public class SysDepartmentController {
    @Autowired
    private SysDepartmentService sysDepartmentService;

    @GetMapping(value = "/getdep")
    public RLIST getdep(@RequestParam("id") int id){
        List<SysDepartment> getsysdep = sysDepartmentService.getsysdep2(id);
        return RLIST.ok().data("data",getsysdep);
    }


    @GetMapping(value = "/test")
    public RLIST getde1(@RequestParam("pid") int pid){
        List<SysDepartment> getsysdep = sysDepartmentService.getsysdep(pid);
        return RLIST.ok().data("data",getsysdep);
    }

    @GetMapping(value = "/test2")
    public RLIST getdep2(@RequestParam("pid") int pid){
        List<SysDepartment> getsysdep = sysDepartmentService.getsysdep2(pid);
        return RLIST.ok().data("data",getsysdep);
    }

    @GetMapping(value = "/test3")
    public RLIST getdep3(@RequestParam("pid") int pid, @RequestParam("id") int id){
        List<SysDepartment> getsysdep = sysDepartmentService.getsysdep3(pid,id);
        return RLIST.ok().data("data",getsysdep);
    }
}

